package com.zzyl.springTask;

import com.zzyl.mapper.ReservationMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
@Slf4j
public class Task {
    @Autowired
    private ReservationMapper reservationMapper;
    /**
     * 定时任务 每小时的16分钟和46分钟自动执行-+
     */
    @Scheduled(cron = "0 16,46 * * * ?")
    public void executeTask() {
        reservationMapper.updateReservationStatus(LocalDateTime.now());
    }
}
